package com.cmstop.bzgd.ui.activities;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

import com.cmstop.bzgd.R;
import com.cmstop.bzgd.base.BaseActivity;
import com.cmstop.bzgd.beans.FocusColumn;
import com.cmstop.bzgd.ui.fragment.HomeCommonFragment;
import com.cmstop.bzgd.ui.utils.TitleUtils;


import butterknife.ButterKnife;
import butterknife.OnClick;

public class HomeProjectActivity extends BaseActivity {


    @Override
    protected void initInject() {
        setContentView(R.layout.activity_home_project);
        ButterKnife.bind(this);
        FocusColumn column= (FocusColumn) getIntent().getSerializableExtra(EX_DATA);


        HomeCommonFragment fragment = new HomeCommonFragment();
        if(column!=null){
            new TitleUtils(this).useAndSetTxTitle(column.getChannelName());
            fragment.setChannelUrl(column.getChannelUrl());
        }
        addFragmentToActivity(getSupportFragmentManager(), fragment, R.id.frameContent);
    }
    public void addFragmentToActivity(FragmentManager fragmentManager,
                                      Fragment fragment, int frameId) {
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.replace(frameId, fragment);
        transaction.commitAllowingStateLoss();
    }

    @OnClick(R.id.title_top_back)
    public void onViewClicked() {
        finish();
    }
}
